package ui;

import java.awt.Color;

import org.dyn4j.geometry.Shape;

public abstract class AbsGameElement implements GameElementIfc {
	protected volatile Color color;
	protected volatile double x;
	protected volatile double y;
	protected volatile double width;
	protected volatile double height;
	protected static double xMax;
	protected static double yMax;

	// The velocity is plus up acceleration per time unit 9.8 * 10^(-3) mm/s^2
	protected final double ACCELERATION = 0.0098;
	protected double PIXEL = 10; // conversion ratio: 1 pixel = PIXEL millimeter(s)
	protected volatile int movingDir;
	protected double lostEnergy;
	protected double vInit;
	protected double xOld;
	protected double yOld;

	protected Shape shape;

	public AbsGameElement() {
		super();
		this.movingDir = 0;
		this.vInit = 0;
	}

	@Override
	public synchronized void doMove(double deltaTime) {

	}

	public Color getColor() {
		return color;
	}

	public void setColor(Color color) {
		this.color = color;
	}

	public int getX() {
		return (int) Math.ceil(x);
	}

	public void setX(double x) {
		this.x = x;
	}

	public int getY() {
		return (int) Math.ceil(y);
	}

	public void setY(double y) {
		this.y = y;
	}

	public int getWidth() {
		return (int) Math.ceil(width);
	}

	public void setWidth(double width) {
		this.width = width;
	}

	public int getHeight() {
		return (int) Math.ceil(height);
	}

	public void setHeight(double height) {
		this.height = height;
	}

	public static double getxMax() {
		return xMax;
	}

	public static void setxMax(double xMax) {
		AbsGameElement.xMax = xMax;
	}

	public static double getyMax() {
		return yMax;
	}

	public static void setyMax(double yMax) {
		AbsGameElement.yMax = yMax;
	}

	public int getDirMove() {
		return movingDir;
	}

	public void setDirMove(int dirMove) {
		this.movingDir = dirMove;
	}
}
